package org.javaboy.shutdown_demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.ApplicationPidFileWriter;

@SpringBootApplication
public class ShutdownDemoApplication {

    public static void main(String[] args) {
//        SpringApplication.run(ShutdownDemoApplication.class, args);
        SpringApplication app = new SpringApplication(ShutdownDemoApplication.class);
        //将系统的进程 id 写入到指定的文件中
        app.addListeners(new ApplicationPidFileWriter("D:\\demo\\app.pid"));
        app.run(args);
    }

}
